﻿Imports System.Xml
Imports System.Xml.Schema

Public Module InputHelpers
    Public Function SchemaSet() As XmlSchemaSet
        Dim schema As XmlSchema = GetStylesheet("GameEngine.KeyMap.xsd")
        SchemaSet = New XmlSchemaSet
        SchemaSet.Add(schema)
    End Function

    Public Function GetStylesheet(ByVal strIdentifier As String) As XmlSchema
        Dim stream = Reflection.Assembly.GetCallingAssembly.GetManifestResourceStream(strIdentifier)
        GetStylesheet = XmlSchema.Read(stream, Sub() Throw New IO.FileLoadException)
        stream.Close()
    End Function

    Public Function GetKeyMapXML(ByVal strIdentifier As String) As XmlDocument
        Dim stream = Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(strIdentifier)
        GetKeyMapXML = New XmlDocument()
        GetKeyMapXML.Load(stream)
        stream.Close()
    End Function
End Module
